
import 'package:flutter/material.dart';
class AbsorbPointTest extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return AbsorbPointEx();
  }
}
class AbsorbPointEx extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return _AbsorbPointEx();
  }
}

class _AbsorbPointEx extends State<AbsorbPointEx>{
  bool absorbing = false;
  @override
  Widget build(BuildContext context) {
    return Scaffold(appBar: AppBar(title: Text('AbsorbPointer 示例'),),
      body: Center(
        child: Stack(
          alignment: AlignmentDirectional.center,
          children: [
            SizedBox(
              width: 200,
              height: 100.0,
              child: ElevatedButton(
                onPressed: (){
                  setState(() {
                    absorbing = !absorbing;
                  });
                },
                child: null,
              ),
            ),
            SizedBox(
              width: 100,
              height: 200.0,
              child: AbsorbPointer(
                absorbing: absorbing,
                child: ElevatedButton(onPressed: (){},
                    style: ElevatedButton.styleFrom(primary: Colors.blue.shade200),
                    child: null),
              ),
            )
          ],
        ),
      ),);
  }
}